From 55c3f7f34f4da112a96260b7653ea955449331b8 Mon Sep 17 00:00:00 2001 From: "emellor@leeni.uk.xensource.com" Date: Mon, 31 Oct 2005 17:03:13 +0100 Subject: [PATCH] From Gerd Knorr : Watch events may get lost, the xenstored response races against the new watch being added to the watch list in register_xenbus_watch(). Fixed by adding the watch to the list unconditionally, and remove it in the error case. That one fixes the network issues I'm seeing. Due to the race the "online" hotplug event for the vif backend was lost sometimes. Signed-off-by: Ewan Mellor --- linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c index d55037177b..55ba4b41ad 100644 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c @@ -682,14 +682,15 @@ int register_xenbus_watch(struct xenbus_watch *watch) spin_lock(&watches_lock); BUG_ON(find_watch(token)); + list_add(&watch->list, &watches); spin_unlock(&watches_lock); err = xs_watch(watch->node, token); /* Ignore errors due to multiple registration. */ - if ((err == 0) || (err == -EEXIST)) { + if ((err != 0) && (err != -EEXIST)) { spin_lock(&watches_lock); - list_add(&watch->list, &watches); + list_del(&watch->list); spin_unlock(&watches_lock); } -- 2.30.2